<?php

/*
*###########################################################################################################################*
#															    															#
#															    															#
#    **  ** ****** ** **  **  ****** ** ***   ** ***   ****** ** **  **  ** **  ** ** **  **    ****   ** **  **  ******    #
#    **  ** ****** ********** ****** *******  *******  ****** ********** ** **  ** **********  ******  ********** ******    #
#    **  ** **  ** **  **  ** **     ***   ** **    ** **     **  **  **    **  ** **  **  ** ***   ** **  **  ** **        #
#    ****** **  ** **  **  ** ****** **   *** **   *** ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    ****** **  ** **  **  ** ****** *******  *******  ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    **  ** **  ** **  **  ** **     *****    ******   **     **  **  ** ** **  ** **  **  ** ***   ** **  **  **     **    #
#    **  ** ****** **  **  ** ****** **       **  ***  ****** **  **  ** ** ****** **  **  **  ******  **  **  ** ******    #
#    **  ** ****** **  **  ** ****** **       **   *** ****** **  **  ** **  ** ** **  **  **   ****   **  **  ** ******    #
#															    															#
#															    															#
#															    															#
#    2010 - 2011 © HomePremiumCMS made by HomePemium as PremiumEye & Security by HomePremium and Merijnz		    		#
#															    															#
#    Powered by PhoenixPHP 3.7.1 (build 138000)										    									#
#															    															#
#															    															#
#															    															#
*###########################################################################################################################*
*/

define('USERNAME_REQUIRED', TRUE);
define('ACCOUNT_REQUIRED', TRUE);
include('../global.php');
define("THIS_SCRIPT", 'display');
$username = $core->EscapeString($_SESSION['username']);
$email = $core->EscapeString($_SESSION['account']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $sitename." - Forum"; ?></title>

<link type="text/css" rel="stylesheet" href="../Public/Styles/<?php echo $currentstyle ?>/CSS/main.css" />
</head>

<body>

<?php include("header.php"); ?>

<div class="mainBox">

	<?php include("navigation.php"); ?>

	<div class="mid" id="midcontent">
    
    	<div style="width: 930px; margin-left: 1px; float: left; margin-top:10px;">
        
        	<div id="forum_top"></div>
        
        	<div id="forum_middle">
            	
                <div style="margin-top: -14px;"></div>
                
                <?php 
				$query = mysql_query("SELECT * FROM forum_titles WHERE id = ".$core->EscapeString($_GET['forum']).""); 
				$forumm = mysql_fetch_array($query);
				
				$queryt = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread']).""); 
				$forumt = mysql_fetch_array($queryt);
				?>
                
                <div id="forum_rounded_container_light_grey">
                
                	<a href="display.php">&laquo; Forum - Home</a> 
                    
                    || 
                    
                    <a href="threads.php?id=<?php echo $core->EscapeString($_GET['forum']); ?>">&laquo; <?php echo $forumm['name']; ?></a>
                    
                    ||
                    
                    <a href="thread.php?thread=<?php echo $core->EscapeString($_GET['thread']); ?>&id=<?php echo $core->EscapeString($_GET['forum']); ?>">&laquo; <?php echo $forumt['name']; ?></a>
                    
                </div>
                
                <?php 
				$query = mysql_query("SELECT * FROM forum_threads WHERE id = ".$core->EscapeString($_GET['thread']).""); 
				$forum = mysql_fetch_array($query);
				
				$vieuw = mysql_query("UPDATE forum_threads SET vieuws = ".$forum['vieuws']."+1 WHERE id = ".$core->EscapeString($_GET['thread'])."");

				$queryu = mysql_query("SELECT * FROM users WHERE username = '".$forum['made_by']."'");
				$user = mysql_fetch_array($queryu);
				
				$queryp = mysql_query("SELECT * FROM forum_reactions WHERE name = '".$forum['made_by']."'");
				$posts = mysql_num_rows($queryp);
				
				if($forumt['shielding'] == 'no' && $forumt['closed'] == 'no'){
				?>

            	<form method="post" action="actions/reaction.php">
                
                	<div id="forum_items">
                
                		<div id="forum_rounded_container" style="margin-top: 0;"><?php echo $lang['quick_reaction']; ?></div>
                        
                        <input type="hidden" name="name" value="<?php echo $username; ?>" />
                
                		<textarea id="editor" cols="80" name="text" style="width: 100%;height: 300px;"></textarea>
                        
                        <script type="text/javascript">

							CKEDITOR.replace( 'editor',
								{
									contentsCss : '../Public/Styles/Default/CSS/main.css',
									enterMode : CKEDITOR.ENTER_BR,
									language : '<?php echo $language; ?>'
								});

						</script>
                        
                        <input type="hidden" name="thread" value="<?php echo $core->EscapeString($_GET['thread']); ?>" />
                        
                        <input type="hidden" name="forum" value="<?php echo $core->EscapeString($_GET['forum']); ?>" />
                    
                	</div>
                
                	<div id="forum_items" style="margin-bottom: -30px;">
                
                		<input style="float: left;" type="submit" value="<?php echo $lang['post']; ?>" />
                
               		</div>
                
                </form>
                
                <div id="forum_rounded_container"><?php echo $lang['reactions']; ?></div>
                
                <?php 
				$query = mysql_query("SELECT * FROM forum_reactions WHERE thread = ".$core->EscapeString($_GET['thread'])." ORDER BY published DESC LIMIT 10"); 

			  	while($forum = mysql_fetch_array($query)){
				
				$queryu = mysql_query("SELECT * FROM users WHERE username = '".$forum['name']."'");
				$user = mysql_fetch_array($queryu);
				
				$queryp = mysql_query("SELECT * FROM forum_reactions WHERE name = '".$forum['name']."'");
				$posts = mysql_num_rows($queryp);

				echo '
                
            	<div id="forum_items">
                
                	<div id="left">
                    
                    	<div id="member_info">
						
							<div id="name_title">
							
								<div style="float: left;">
							
									'.$user['username'].'
									
								</div>

								';
								?>
									
                        <?php
						if($user['online'] == 1)
						{
						?>
							<div style="float: right;"><img src="../Public/Styles/Default/Images/online.gif" /></div><br />
						<?php
						}
						else
						{
						?>
							<div style="float: right;"><img src="../Public/Styles/Default/Images/offline.gif" /></div><br />
						<?php
						}
						?>
									
								<?php	
								
								echo '
							
							</div>
							
							<div id="avatar_container">
							
								<img src="http://habbo.nl/habbo-imaging/avatarimage?figure='.$user['look'].'">
								
							</div>
							
							<div id="info_text">
							
								'.$lang['me_user_info_last_online'].':<br>
								<b>'.@date("d-m-Y", $user['last_online']).' '.$lang['me_user_info_last_online_on'].' '.@date("H:i", $user['last_online']).'</b><br>
								<br>
								'.$lang['me_user_info_rank'].':<br>
								<b>'.$user['rank'].'</b><br><br>
								Posts:<br>
								<b>'.$posts.'</b>
								
							</div>
							
						</div>
                        
                    </div>
					
					<div id="right" style="width: 640px;">
					
						<div id="text_container">
						
							<div id="liddle_published">'.$lang['posted_on'].': '.@date("d-m-Y", $forum['published']).' '.$lang['me_user_info_last_online_on'].' '.@date("H:i", $forum['published']).'</div>
						
							'.html_entity_decode($forum['text']).'
						
						</div>
						
					</div>
					
				</div>
					';
			   }
			   }else{
				   echo'
				   <div style="background-color: #FF1616; border: 1px solid #FF1616; border-radius: 4px; padding: 10px 10px 10px 10px; color: #990000;">
            				Deze Thread is gesloten.
            			</div>
					';
			   }
				?>
                
                
                
            </div>
            
            <div id="forum_bottom"></div>
        
        </div>
        
    </div>
    
    <?php include("../system/footer.php"); ?>
    
</div>
</body>
</html>